
package ch.hearc.coursJava.exa3;



public class ThreadAdd implements Runnable
	{

	/*------------------------------------------------------------------*\
	|*							Constructeurs							*|
	\*------------------------------------------------------------------*/
	public ThreadAdd(int[] tab1, int[] tab2, int[] tabRes, int first, int step)
		{
		this.tab1 = tab1;
		this.tab2 = tab2;
		this.tabRes = tabRes;
		this.step = step;
		this.first = first;
		}
	/*------------------------------------------------------------------*\
	|*							Methodes Public							*|
	\*------------------------------------------------------------------*/
	@Override
	public void run()
		{
		System.err.println();
		for(int i=first ; i<tabRes.length; i+=step)
			{
			tabRes[i]= tab1[i] + tab2[i];
			}
		System.err.println(Thread.currentThread().getName()+ " - "+Thread.currentThread().getId());
		}

	/*------------------------------------------------------------------*\
	|*							Attributs Private						*|
	\*------------------------------------------------------------------*/
	private int[] tab1;
	private int[] tab2;
	private int[] tabRes;
	private int step;
	private int first;
	}

